﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MH.CRM.Summary.CrmSdk;
using System.Windows.Browser;

namespace MH.CRM.Summary
{
    public partial class Attachment : UserControl
    {
        public Attachment()
        {
            InitializeComponent();
        }

        public Guid Id
        {
            get
            {
                return attachment.GetAttributeValue<Guid>("activitymimeattachmentid");
            }
        }

        public string SuperofficePath
        {
            get;
            set;
        }

        public string FileName
        {
            get
            {
                return attachment.GetAttributeValue<string>("filename");
            }
        }

        Entity attachment;
        public void Init(Entity entity)
        {
            attachment = entity;
            this.hbtnAttachment.Content = FileName;
           this.hbtnAttachment.NavigateUri = new Uri(SilverlightUtility.GetServerBaseUrl() + "/activities/attachment/edit.aspx?id=" + this.Id.ToString());
          
        }

        public void Init(string navigateURI)
        {
            this.hbtnAttachment.Content = "SuperOffice Email Attachment";
          //  this.SuperofficePath = navigateURI;
            this.hbtnAttachment.NavigateUri = new Uri(navigateURI);
        }
    }
}
